<%@page language="java" isELIgnored="false" contentType="text/html"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix='fn' uri='http://java.sun.com/jsp/jstl/functions'%>
<div style="float: right; margin: 5px 5px 0px 0px; display: none;">
		<form method="post" action="">
			<input type="text" class="uiTextbox" id="txtSearch" size="30" name="query" value="${query }" /> <input
				type="submit" class="uiButton" id="btnSearchSubmit" value="Search" />
		</form>
</div>
<div style="clear: both;">
Farm Name: 
<a href="farm?action=view">${farm.name }</a> >>
</div>

<div id="farmButtonStrip" class="buttonStrip">
	<div style="float:left;">
		<a id="btnAddFarm" class="uiButton" href="farm?action=add&item=kraal&farmid=${farm.id}">Add</a>
		<a id="btnEditKraal" class="uiButton" href="farm?action=edit&item=kraal&farmid=${farm.id}">Edit</a>
		<a id="btnDeleteKraal" class="uiButton" href="farm?action=delete&item=kraal&farmid=${farm.id}">Delete</a>
	</div>
	<div style="float:right;">
		<%@ include file="/WEB-INF/views/navigation.jsp" %>
	</div>
	<div style="clear:both"></div>	
</div>
<div>
	<div style="clear: both"></div>
	<div style="clear: both">
		<div id="farmRecords" style="min-height: 400px;">
		<c:if test="${not empty farm }">
			<input type="hidden" name="hdnFarmId" id="hdnFarmId" value="${farm.id }"/>
		</c:if>
			<table class="recordTable" width="100%" cellpadding="0" cellspacing="0">
				<thead>
					<tr>
						<th><input type="checkbox" id="cbxSelectAllItems" /></th>
						<th>Name</th>
						<th>No of Animals</th>
					</tr>
				</thead>
				
				<tbody>	<c:choose>
						<c:when test="${not empty kraals  && fn:length(kraals) > 0}">
							<c:forEach var="kraal" items="${kraals }">
							
										<tr id="${kraal.id }" url="farm?action=view&item=kraalanimals&kraalid=${kraal.id }">
											<td><input name="selectedKraal" type="checkbox" id="${kraal.id }" value="${kraal.id }" />
											</td>
											<td>${kraal.name }</td>
											<td>${fn:length(kraal.animals)}</td>
										</tr>
								
							</c:forEach>
						</c:when>
						</c:choose>
				</tbody>
			</table>
		</div>
	</div>
</div>